package com.nyc.config;

import com.nyc.anno.ConditionOnClass;
import com.nyc.anno.TomcatWebServer;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.context.WebApplicationContext;

/**
 * @author niuyicong
 * @date 2025/9/23  10:37:31
 * @description
 */
@Configuration
public class WebServerConfig {
    @Autowired
    @Bean
    @ConditionOnClass(value = "org.apache.catalina.startup.Tomcat")
    public TomcatWebServer tomcatWebServer(WebApplicationContext applicationContext){
        return new TomcatWebServer(applicationContext);
    }
}
